Repository navigation
Conversation
mbg
added this pull request to stack #4224
October 9, 2026 22:30
mbg
force-pushed
the
mbg/diagnostics/failed-sarif
branch
2 times, most recently
from
October 9, 2026 22:51
520eff7 to
2613b9c
Compare
mbg
removed this pull request from stack #4224
October 12, 2026 11:00
mbg
force-pushed
the
mbg/diagnostics/failed-sarif
branch
from
October 12, 2026 11:54
b5ce898 to
9312ede
Compare
mbg
changed the base branch from
mbg/fs-abstraction
to
mbg/reduce-config-requirements
October 12, 2026 11:54
mbg
force-pushed
the
mbg/diagnostics/failed-sarif
branch
from
October 12, 2026 12:02
9312ede to
65d8aa4
Compare
mbg
force-pushed
the
mbg/diagnostics/failed-sarif
branch
from
October 12, 2026 13:23
65d8aa4 to
9eeab46
Compare
mbg
marked this pull request as ready for review
October 12, 2026 13:24
Contributor
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
🟡 Changes recommended
Temporary-write failures can abort initialization, cross-filesystem moves can lose diagnostics, and the new check does not validate failed SARIF export.
5 open findings
What changed in this PR
Persists pre-database diagnostics on disk so they can be included in failed SARIF output.
Changes:
- Replaces in-memory buffering with temporary diagnostic files.
- Passes temporary diagnostics to CodeQL export.
- Adds unit and PR-check coverage.
| File | Description |
|---|---|
src/diagnostics.ts |
Implements temporary persistence and database relocation. |
src/init-action.ts |
Flushes and logs temporary diagnostics. |
src/init-action-post-helper.ts |
Supplies temporary diagnostics during failed SARIF generation. |
src/codeql.ts |
Adds --diagnostic-dir support. |
src/diagnostics.test.ts |
Tests temporary persistence and flushing. |
src/setup-codeql.test.ts |
Provides temporary-directory test setup. |
src/config/db-config.test.ts |
Provides temporary-directory test setup. |
pr-checks/diagnostics-without-db.ts |
Checks for the expected diagnostic file. |
pr-checks/checks/diagnostics-without-db.yml |
Defines the new PR check. |
lib/entry-points.js |
Generated bundle; excluded from review. |
.github/workflows/__diagnostics-without-db.yml |
Generated workflow; excluded from review. |
Files excluded by content exclusion policy (2)
- .github/workflows/__diagnostics-without-db.yml
- lib/entry-points.js
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+22
to
+24
| - name: Check diagnostics appear on disk | ||
| env: | ||
| SARIF_PATH: "${{ runner.temp }}/codeql-action-temp-diagnostics/" |
mbg
added this pull request to stack #4227
October 12, 2026 13:49
mbg
force-pushed
the
mbg/diagnostics/failed-sarif
branch
from
October 12, 2026 16:51
4b32487 to
9104ff3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Diagnostics are typically written to the database cluster and are then included in the SARIF that is generated by the CLI. However, in the CodeQL Action we may produce diagnostics before the database cluster is initialised. To work around this, we have so far relied on tracking diagnostics in memory that were created before the database cluster is ready. After the cluster is initialised, those diagnostics are then flushed to disk. However, this represents a problem if the database cluster is never successfully initialised.
This PR changes this so that diagnostics are written directly to a temporary directory on disk if the database cluster is not yet ready. They are then moved to the database cluster once it is initialised. If the cluster is never initialised, then we point the CLI at the temporary directory on disk using a
--diagnostic-dirargument. The CLI will then pick up any diagnostics that are still in that location and include them in the failed SARIF.Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist